package com.lmxdawn.api.dnf.job;

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.lmxdawn.api.admin.entity.GoldCoin;
import com.lmxdawn.api.admin.entity.auth.AuthAdmin;
import com.lmxdawn.api.admin.service.IGoldCoinService;
import com.lmxdawn.api.admin.service.auth.AuthAdminService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Component
@Slf4j
public class UserJob {


    @Resource
    AuthAdminService authAdminService;
    //推送方法，每秒执行一次
    @Scheduled(fixedRate = 60*10000)
    public void check() throws InterruptedException {
        List<AuthAdmin> list = authAdminService.listExpireUser();
        for (AuthAdmin admin : list) {
            authAdminService.updateOnlineStatus("0", admin.getId());
            log.info("用户下线");
        }
    }

}
